Skip to content

Conversation

@VerzatileDev
Copy link
Contributor

The current modification implements local storage for the selected theme using an event listener. This ensures that the chosen theme persists even when users leave and return to the site. By default, the website adopts a white theme, but users can change it. The selected theme should remain fixed upon subsequent visits.

For the theme selection, I've utilized default Windows emojis for the Sun and moon icons, enhancing the visual appeal. Notably, I've maintained a visible border on the icon to signify its selectability.

There don't seem to be any performance issues, but there's a minor inconvenience where the page initially loads with a white theme before flickering to the selected theme. This may be more noticeable on slower internet connections, potentially revealing the behind-the-scenes of the website. Whether this is a significant issue is open to discussion.

Key changes can be found in the following files:

  1. config: Sets the default color scheme.
  2. Aux_nav: Adds a new navigation list item to the top-right panel, labeled "Contribute to.."
    3 Head.html: Modifies stylesheets and introduces a script for the default "just the docs" theme.js, essentially fixing it to the original code.
  3. Default.html: Incorporates the local script "colorThemeSelection.js," responsible for controlling the theme button, selection, and loading.
  4. ColorThemeSelection.js: Enhances readability and functionality as described.

Issues

The following issues are as listed:

  • Theme by default is forced to be " light " themed, which means that upon page change it has to be overwritten which introduces flickering to the website when it is changed.
  • May have issues on very slow internet where the user could see the backsite, but shouldn't be too worried about it performance seem to be valid for the site still.

Fixes

It would be possible to force load stylesheets globally so that the theme changes it for the entire site, but it has underlying issues with the way ruby website is setup and might need internal code changes.

With the current modification the theme selected is stored locally with an eventListener that stores that information and asks for it.

By default the website will be on a white theme, unless the user changes it, in theory the selection should stay fixed even when the user leave the site and comes back later.

For the icons I used a the default windows emojis of the Sun and moon, which I think work great and show it off to its best abilities.

Additionally I left the Border on the icon so indicate that it can be selected or changed.

Doesn't seem to have a performance issues.

Does have an issue that page by default is white themed, so upon changing it flickers with the lights, occasionally on slow internets it may show behind the scenes of the website which could be an issue but that is up for debate.

See files changed

config -> Selects the default color scheme
Aux_nav -> adds a new nav list item to the top right panel where " Contribute to .. " is located as a label button

Head.html -> Modifies the stylesheets and adds a script of the default " just the docs " theme .js  Essentially it has been fixated to the original code

Default.html -> Adds our local script " colorThemeSelection.js " this is what controls the theme button and selection and load.

ColorThemeSelection.js -> As described
@VerzatileDev VerzatileDev added 🌈 Type: Cosmetic Edits to layout or looks. 🌟 Type: Feature New feature or repository request. 👁️ Review: Required This PR is ready for review. ⚠️ Priority: Minor Should be addressed where possible, if there are resources to spare. labels Feb 8, 2024
@VerzatileDev VerzatileDev requested review from a team February 8, 2024 02:34
@VerzatileDev VerzatileDev self-assigned this Feb 8, 2024
@VerzatileDev
Copy link
Contributor Author

References #44 as Feature [ADD]
Needs to be addressed in some areas #74 [ADDRESS]

Copy link
Collaborator

@JDSherbert JDSherbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, one potential thing to add later

@JDSherbert JDSherbert added ✅ Review: Approved PR is approved and ready for merge. and removed 👁️ Review: Required This PR is ready for review. labels Feb 8, 2024
@JDSherbert JDSherbert merged commit ea2c704 into VerzatileDevOrg:main Feb 8, 2024
@VerzatileDev VerzatileDev deleted the LightDarkSwitchOption1 branch February 11, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ Priority: Minor Should be addressed where possible, if there are resources to spare. ✅ Review: Approved PR is approved and ready for merge. 🌈 Type: Cosmetic Edits to layout or looks. 🌟 Type: Feature New feature or repository request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants